import unittest
from ddt import ddt,data,unpack

data1 = ["123",'234']
data2 = {"username":"allen","password":"123456"}
data3 = [{"username":"allen","password":"123456"},{"username":"allen1","password":"1234567"}]

@ddt()
class TestDemo(unittest.TestCase):

    @data(*data1)
    def test_print_data1(self, item):
        print(item)

    @data(data2)
    @unpack  # 去括号，去字典的括号
    def test_print_data2(self, username, password):
        print(1)
        print(username, password)


    @data(*data3)
    @unpack
    def test_print_data3(self, username, password):
        print(username, password)


if __name__ == '__main__':
    unittest.main()


